﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RoadTeam.SysInterface;
using RoadTeam.Enums;
using RoadTeam.Model;
using System.Data;

namespace RoadTeam.BsSystem.SM
{
    public class Staff_Sys : ISmStaff
    {
        public String GetStaffID(String StaffIdentifier)
        {
            SqlWhere where = new SqlWhere();
            where.Info = new Model.TbSmStaff() { StaffIdentifier = StaffIdentifier };
            where.SelectColumn = @" Top 1 StaffID ";
            DataTable dt = TbSmStaff.Select(where, GlobalConfig.RtConnectionString);
            if (dt.Rows.Count == 0) return @"-1";
            return dt.Rows[0][0].ToString();
        }


        public DataTable GetStaffTable()
        {
            SqlWhere where = new SqlWhere();
            where.Info = new Model.TbSmStaff() {  };
            where.SelectColumn =@" StaffID,StaffName,StaffCode,OrganID,UserID,StaffIdentifier,'' ";
            where.StrSqlWhere = @" StaffIdentifier is null AND isnull( IsDisable,'N')<>'Y' AND Status='Y'  ";
            return TbSmStaff.Select(where, GlobalConfig.RtConnectionString);
        }

        public bool UpdateStaffTable(DataTable dt)
        {
          return  TbSmStaff.Update(dt, GlobalConfig.RtConnectionString);
        }









    }
}
